home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume22 / gawk2.11 / part09 < prev    next >
Encoding:
Internet Message Format  |  1990-06-07  |  54.5 KB

  1. Subject:  v22i095:  GNU AWK, version 2.11, Part09/16
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: d2c459a0 c53413e8 d3277205 b947f6c9
  5.  
  6. Submitted-by: "Arnold D. Robbins" <arnold@unix.cc.emory.edu>
  7. Posting-number: Volume 22, Issue 95
  8. Archive-name: gawk2.11/part09
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then feed it
  12. # into a shell via "sh file" or similar.  To overwrite existing files,
  13. # type "sh file -c".
  14. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  15. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  16. # Contents:  ./FUTURES ./PROBLEMS ./missing.d/dup2.c
  17. #   ./missing.d/memcmp.c ./support/texinfo.tex.01
  18. # Wrapped by rsalz@litchi.bbn.com on Wed Jun  6 12:24:54 1990
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. echo If this archive is complete, you will see the following message:
  21. echo '          "shar: End of archive 9 (of 16)."'
  22. if test -f './FUTURES' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'./FUTURES'\"
  24. else
  25.   echo shar: Extracting \"'./FUTURES'\" \(555 characters\)
  26.   sed "s/^X//" >'./FUTURES' <<'END_OF_FILE'
  27. XThis file lists future projects and enhancments for gawk.
  28. X
  29. XSynchronize alloca.[cs] and regex.[ch] with the latest versions at GNU.
  30. X(this will likely be done as a patch to 2.11.)
  31. X
  32. XConvert yylex() to allow arbitrary-length program lines.
  33. X
  34. XAllow OFMT to be other than a floating point format.
  35. X
  36. XMake printf fully compatible with the ANSI C spec.
  37. X
  38. XMake it faster and smaller.
  39. X
  40. XAllow RS to be a regexp.
  41. X
  42. XRead in environment only if necessary. (Is this all that big a deal?)
  43. X
  44. XUse faster regex algorithms.
  45. X
  46. XCreate a gawk-to-C translator?
  47. X
  48. XCreate a gawk compiler?
  49. END_OF_FILE
  50.   if test 555 -ne `wc -c <'./FUTURES'`; then
  51.     echo shar: \"'./FUTURES'\" unpacked with wrong size!
  52.   fi
  53.   # end of './FUTURES'
  54. fi
  55. if test -f './PROBLEMS' -a "${1}" != "-c" ; then 
  56.   echo shar: Will not clobber existing file \"'./PROBLEMS'\"
  57. else
  58.   echo shar: Extracting \"'./PROBLEMS'\" \(380 characters\)
  59.   sed "s/^X//" >'./PROBLEMS' <<'END_OF_FILE'
  60. XThis is a list of known problems in gawk 2.11.
  61. XHopefully they will all be fixed in the next major release of gawk.
  62. X
  63. XPlease keep in mind that this is still beta software and the code
  64. Xis still undergoing significant evolution.
  65. X
  66. X1. The debugging code does not print redirection info.
  67. X
  68. X2. The scanner needs work.
  69. X
  70. X3. Gawk's printf doesn't yet match the latest nawk's.
  71. X
  72. XArnold Robbins
  73. END_OF_FILE
  74.   if test 380 -ne `wc -c <'./PROBLEMS'`; then
  75.     echo shar: \"'./PROBLEMS'\" unpacked with wrong size!
  76.   fi
  77.   # end of './PROBLEMS'
  78. fi
  79. if test -f './missing.d/dup2.c' -a "${1}" != "-c" ; then 
  80.   echo shar: Will not clobber existing file \"'./missing.d/dup2.c'\"
  81. else
  82.   echo shar: Extracting \"'./missing.d/dup2.c'\" \(136 characters\)
  83.   sed "s/^X//" >'./missing.d/dup2.c' <<'END_OF_FILE'
  84. X#ifndef F_DUPFD
  85. X#include <fcntl.h>
  86. X#endif
  87. X
  88. Xint
  89. Xdup2 (old, new)
  90. Xint old, new;
  91. X{
  92. X    (void) close(new);
  93. X
  94. X    return fcntl(old, F_DUPFD, new);
  95. X}
  96. END_OF_FILE
  97.   if test 136 -ne `wc -c <'./missing.d/dup2.c'`; then
  98.     echo shar: \"'./missing.d/dup2.c'\" unpacked with wrong size!
  99.   fi
  100.   # end of './missing.d/dup2.c'
  101. fi
  102. if test -f './missing.d/memcmp.c' -a "${1}" != "-c" ; then 
  103.   echo shar: Will not clobber existing file \"'./missing.d/memcmp.c'\"
  104. else
  105.   echo shar: Extracting \"'./missing.d/memcmp.c'\" \(345 characters\)
  106.   sed "s/^X//" >'./missing.d/memcmp.c' <<'END_OF_FILE'
  107. X/*
  108. X * memcmp --- compare strings.
  109. X *
  110. X * We use our own routine since it has to act like strcmp() for return
  111. X * value, and the BSD manual says bcmp() only returns zero/non-zero.
  112. X */
  113. X
  114. Xint
  115. Xmemcmp (s1, s2, l)
  116. Xregister char *s1, *s2;
  117. Xregister int l;
  118. X{
  119. X    for (; l--; s1++, s2++) {
  120. X        if (*s1 != *s2)
  121. X            return (*s1 - *s2);
  122. X    }
  123. X    return (*--s1 - *--s2);
  124. X}
  125. END_OF_FILE
  126.   if test 345 -ne `wc -c <'./missing.d/memcmp.c'`; then
  127.     echo shar: \"'./missing.d/memcmp.c'\" unpacked with wrong size!
  128.   fi
  129.   # end of './missing.d/memcmp.c'
  130. fi
  131. if test -f './support/texinfo.tex.01' -a "${1}" != "-c" ; then 
  132.   echo shar: Will not clobber existing file \"'./support/texinfo.tex.01'\"
  133. else
  134.   echo shar: Extracting \"'./support/texinfo.tex.01'\" \(49357 characters\)
  135.   sed "s/^X//" >'./support/texinfo.tex.01' <<'END_OF_FILE'
  136. X%% TeX macros to handle texinfo files
  137. X
  138. X%   Copyright (C) 1985, 1986, 1988 Free Software Foundation, Inc.
  139. X
  140. X%GNU CC is free software; you can redistribute it and/or modify
  141. X%it under the terms of the GNU General Public License as published by
  142. X%the Free Software Foundation; either version 1, or (at your option)
  143. X%any later version.
  144. X
  145. X%GNU CC is distributed in the hope that it will be useful,
  146. X%but WITHOUT ANY WARRANTY; without even the implied warranty of
  147. X%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  148. X%GNU General Public License for more details.
  149. X
  150. X%You should have received a copy of the GNU General Public License
  151. X%along with GNU CC; see the file COPYING.  If not, write to
  152. X%the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  153. X
  154. X
  155. X%In other words, you are welcome to use, share and improve this program.
  156. X%You are forbidden to forbid anyone else to use, share and improve
  157. X%what you give them.   Help stamp out software-hoarding!
  158. X
  159. X\def\texinfoversion{2.1}
  160. X\message{Loading texinfo package [Version \texinfoversion]:}
  161. X\message{}
  162. X
  163. X% Save some parts of plain tex whose names we will redefine.
  164. X
  165. X\let\ptexlbrace=\{
  166. X\let\ptexrbrace=\}
  167. X\let\ptexdot=\.
  168. X\let\ptexstar=\*
  169. X\let\ptexend=\end
  170. X\let\ptexbullet=\bullet
  171. X\let\ptexb=\b
  172. X\let\ptexc=\c
  173. X\let\ptexi=\i
  174. X\let\ptext=\t
  175. X\let\ptexl=\l
  176. X\let\ptexL=\L
  177. X
  178. X\def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
  179. X
  180. X\message{Basics,}
  181. X\chardef\other=12
  182. X
  183. X\hyphenation{ap-pen-dix}
  184. X\hyphenation{mini-buf-fer mini-buf-fers}
  185. X\hyphenation{eshell}
  186. X
  187. X% Margin to add to right of even pages, to left of odd pages.
  188. X\newdimen \bindingoffset  \bindingoffset=0pt
  189. X\newdimen \normaloffset   \normaloffset=\hoffset
  190. X\newdimen\pagewidth \newdimen\pageheight
  191. X\pagewidth=\hsize \pageheight=\vsize
  192. X
  193. X%---------------------Begin change-----------------------
  194. X%
  195. X% Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  196. X%
  197. X\newdimen\cornerlong \newdimen\cornerthick
  198. X\newdimen \topandbottommargin
  199. X\newdimen \outerhsize \newdimen \outervsize
  200. X\cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  201. X\outerhsize=7in
  202. X\outervsize=9.5in
  203. X\topandbottommargin=.75in
  204. X%
  205. X%---------------------End change-----------------------
  206. X
  207. X% \onepageout takes a vbox as an argument.  Note that \pagecontents
  208. X% does insertions itself, but you have to call it yourself.
  209. X\chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  210. X\def\onepageout#1{\hoffset=\normaloffset
  211. X\ifodd\pageno  \advance\hoffset by \bindingoffset
  212. X\else \advance\hoffset by -\bindingoffset\fi
  213. X\shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  214. X {\let\hsize=\pagewidth \makefootline}}
  215. X\advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  216. X
  217. X
  218. X% Here is a modification of the main output routine for Near East Publications
  219. X% This provides right-angle cropmarks at all four corners.
  220. X% The contents of the page are centerlined into the cropmarks,
  221. X% and any desired binding offset is added as an \hskip on either
  222. X% site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  223. X%
  224. X\def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  225. X         \shipout
  226. X         \vbox to \outervsize{\hsize=\outerhsize
  227. X                 \vbox{\line{\ewtop\hfill\ewtop}}
  228. X                 \nointerlineskip
  229. X                 \line{\vbox{\moveleft\cornerthick\nstop}
  230. X                       \hfill
  231. X                       \vbox{\moveright\cornerthick\nstop}}
  232. X                 \vskip \topandbottommargin
  233. X                 \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  234. X            \vbox{
  235. X            {\let\hsize=\pagewidth \makeheadline}
  236. X            \pagebody{#1}
  237. X            {\let\hsize=\pagewidth \makefootline}}
  238. X            \ifodd\pageno\else\hskip\bindingoffset\fi}
  239. X         \vskip \topandbottommargin plus1fill minus1fill
  240. X                 \boxmaxdepth\cornerthick
  241. X                 \line{\vbox{\moveleft\cornerthick\nsbot}
  242. X                       \hfill
  243. X                       \vbox{\moveright\cornerthick\nsbot}}
  244. X                 \nointerlineskip
  245. X                 \vbox{\line{\ewbot\hfill\ewbot}}
  246. X    }
  247. X  \advancepageno 
  248. X  \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  249. X%
  250. X% Do @cropmarks to get crop marks
  251. X\def\cropmarks{\let\onepageout=\croppageout }
  252. X
  253. X\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  254. X{\catcode`\@ =11
  255. X\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  256. X\dimen@=\dp#1 \unvbox#1
  257. X\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  258. X\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  259. X}
  260. X
  261. X%
  262. X% Here are the rules for the cropmarks.  Note that they are
  263. X% offset so that the space between them is truly \outerhsize or \outervsize
  264. X% (P. A. MacKay, 12 November, 1986)
  265. X%
  266. X\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  267. X\def\nstop{\vbox
  268. X  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  269. X\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  270. X\def\nsbot{\vbox
  271. X  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  272. X
  273. X% Parse an argument, then pass it to #1.
  274. X% The argument can be delimited with [...] or with "..." or braces
  275. X% or it can be a whole line.
  276. X% #1 should be a macro which expects
  277. X% an ordinary undelimited TeX argument.
  278. X
  279. X\def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
  280. X
  281. X\def\parseargx{%
  282. X\ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
  283. X\aftergroup \parseargline %
  284. X\fi \endgroup}
  285. X
  286. X{\obeyspaces %
  287. X\gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
  288. X
  289. X\gdef\obeyedspace{\ }
  290. X
  291. X\def\parseargline{\begingroup \obeylines \parsearglinex}
  292. X{\obeylines %
  293. X\gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
  294. X
  295. X\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  296. X
  297. X%% These are used to keep @begin/@end levels from running away
  298. X%% Call \inENV within environments (after a \begingroup)
  299. X\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  300. X\def\ENVcheck{%
  301. X\ifENV\errmessage{Still within an environment.  Type Return to continue.}
  302. X\endgroup\fi} % This is not perfect, but it should reduce lossage
  303. X
  304. X% @begin foo  is the same as @foo, for now.
  305. X\newhelp\EMsimple{Type <Return> to continue}
  306. X
  307. X\outer\def\begin{\parsearg\beginxxx}
  308. X
  309. X\def\beginxxx #1{%
  310. X\expandafter\ifx\csname #1\endcsname\relax
  311. X{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  312. X\csname #1\endcsname\fi}
  313. X
  314. X%% @end foo executes the definition of \Efoo.
  315. X%% foo can be delimited by doublequotes or brackets.
  316. X
  317. X\def\end{\parsearg\endxxx}
  318. X
  319. X\def\endxxx #1{%
  320. X\expandafter\ifx\csname E#1\endcsname\relax
  321. X\expandafter\ifx\csname #1\endcsname\relax
  322. X\errmessage{Undefined command @end #1}\else
  323. X\errorE{#1}\fi\fi
  324. X\csname E#1\endcsname}
  325. X\def\errorE#1{
  326. X{\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
  327. X
  328. X% Single-spacing is done by various environments.
  329. X
  330. X\newskip\singlespaceskip \singlespaceskip = \baselineskip
  331. X\def\singlespace{%
  332. X{\advance \baselineskip by -\singlespaceskip
  333. X\kern \baselineskip}%
  334. X\baselineskip=\singlespaceskip
  335. X}
  336. X
  337. X%% Simple single-character @ commands
  338. X
  339. X% @@ prints an @
  340. X% Kludge this until the fonts are right (grr).
  341. X\def\@{{\sf \char '100}}
  342. X
  343. X% Define @` and @' to be the same as ` and '
  344. X% but suppressing ligatures.
  345. X\def\`{{`}}
  346. X\def\'{{'}}
  347. X
  348. X% Used to generate quoted braces.
  349. X
  350. X\def\mylbrace {{\tt \char '173}}
  351. X\def\myrbrace {{\tt \char '175}}
  352. X\let\{=\mylbrace
  353. X\let\}=\myrbrace
  354. X
  355. X% @: forces normal size whitespace following.
  356. X\def\:{\spacefactor=1000 }
  357. X
  358. X% @* forces a line break.
  359. X\def\*{\hfil\break}
  360. X
  361. X% @. is an end-of-sentence period.
  362. X\def\.{.\spacefactor=3000 }
  363. X
  364. X% @w prevents a word break
  365. X\def\w #1{\hbox{#1}}
  366. X
  367. X% @group ... @end group  forces ... to be all on one page.
  368. X
  369. X\def\group{\begingroup% \inENV ???
  370. X\def \Egroup{\egroup\endgroup}
  371. X\vbox\bgroup}
  372. X
  373. X% @br   forces paragraph break
  374. X
  375. X\let\br = \par
  376. X
  377. X% @dots{}  output some dots
  378. X
  379. X\def\dots{$\ldots$}
  380. X
  381. X% @page    forces the start of a new page
  382. X
  383. X\def\page{\par\vfill\supereject}
  384. X
  385. X% @exdent text....
  386. X% outputs text on separate line in roman font, starting at standard page margin
  387. X
  388. X\def\exdent{\errmessage{@exdent in filled text}}
  389. X  % @lisp, etc, define \exdent locally from \internalexdent
  390. X
  391. X{\obeyspaces
  392. X\gdef\internalexdent{\parsearg\exdentzzz}}
  393. X
  394. X\def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
  395. X\advance \hsize by -\leftskip
  396. X\advance \hsize by -\rightskip
  397. X\leftline{{\rm#1}}}}
  398. X
  399. X% @include file    insert text of that file as input.
  400. X
  401. X\def\include{\parsearg\includezzz}
  402. X\def\includezzz #1{{\def\thisfile{#1}\input #1
  403. X}}
  404. X
  405. X\def\thisfile{}
  406. X
  407. X% @center line   outputs that line, centered
  408. X
  409. X\def\center{\parsearg\centerzzz}
  410. X\def\centerzzz #1{{\advance\hsize by -\leftskip
  411. X\advance\hsize by -\rightskip
  412. X\centerline{#1}}}
  413. X
  414. X% @sp n   outputs n lines of vertical space
  415. X
  416. X\def\sp{\parsearg\spxxx}
  417. X\def\spxxx #1{\par \vskip #1\baselineskip}
  418. X
  419. X% @comment ...line which is ignored...
  420. X% @c is the same as @comment
  421. X% @ignore ... @end ignore  is another way to write a comment
  422. X
  423. X\def\comment{\parsearg \commentxxx}
  424. X
  425. X\def\commentxxx #1{}
  426. X
  427. X\let\c=\comment
  428. X
  429. X% Prevent errors for section commands.
  430. X% Used in @ignore and in failing conditionals.
  431. X\def\ignoresections{%
  432. X\let\chapter=\relax
  433. X\let\unnumbered=\relax
  434. X\let\unnumberedsec=\relax
  435. X\let\unnumberedsection=\relax
  436. X\let\unnumberedsubsec=\relax
  437. X\let\unnumberedsubsection=\relax
  438. X\let\unnumberedsubsubsec=\relax
  439. X\let\unnumberedsubsubsection=\relax
  440. X\let\section=\relax
  441. X\let\subsec=\relax
  442. X\let\subsubsec=\relax
  443. X\let\subsection=\relax
  444. X\let\subsubsection=\relax
  445. X\let\appendix=\relax
  446. X\let\appendixsec=\relax
  447. X\let\appendixsection=\relax
  448. X\let\appendixsubsec=\relax
  449. X\let\appendixsubsection=\relax
  450. X\let\appendixsubsubsec=\relax
  451. X\let\appendixsubsubsection=\relax
  452. X}
  453. X
  454. X\def\ignore{\begingroup\ignoresections\ignorexxx}
  455. X\long\def\ignorexxx #1\end ignore{\endgroup}
  456. X
  457. X% Conditionals to test whether a flag is set.
  458. X
  459. X\outer\def\ifset{\begingroup\ignoresections\parsearg\ifsetxxx}
  460. X
  461. X\def\ifsetxxx #1{\endgroup
  462. X\expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\ifsetfail
  463. X\else \let\temp=\relax \fi
  464. X\temp}
  465. X\def\Eifset{}
  466. X\def\ifsetfail{\begingroup\ignoresections\ifsetfailxxx}
  467. X\long\def\ifsetfailxxx #1\end ifset{\endgroup}
  468. X
  469. X\outer\def\ifclear{\begingroup\ignoresections\parsearg\ifclearxxx}
  470. X
  471. X\def\ifclearxxx #1{\endgroup
  472. X\expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\relax
  473. X\else \let\temp=\ifclearfail \fi
  474. X\temp}
  475. X\def\Eifclear{}
  476. X\def\ifclearfail{\begingroup\ignoresections\ifclearfailxxx}
  477. X\long\def\ifclearfailxxx #1\end ifclear{\endgroup}
  478. X
  479. X% Some texinfo constructs that are trivial in tex
  480. X
  481. X\def\iftex{}
  482. X\def\Eiftex{}
  483. X\def\ifinfo{\begingroup\ignoresections\ifinfoxxx}
  484. X\long\def\ifinfoxxx #1\end ifinfo{\endgroup}
  485. X
  486. X\long\def\menu #1\end menu{}
  487. X\def\asis#1{#1}
  488. X
  489. X\def\node{\ENVcheck\parsearg\nodezzz}
  490. X\def\nodezzz#1{\nodexxx [#1,]}
  491. X\def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  492. X\let\lastnode=\relax
  493. X
  494. X\def\donoderef{\ifx\lastnode\relax\else
  495. X\expandafter\expandafter\expandafter\setref{\lastnode}\fi
  496. X\let\lastnode=\relax}
  497. X
  498. X\def\unnumbnoderef{\ifx\lastnode\relax\else
  499. X\expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  500. X\let\lastnode=\relax}
  501. X
  502. X\def\appendixnoderef{\ifx\lastnode\relax\else
  503. X\expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  504. X\let\lastnode=\relax}
  505. X
  506. X\let\refill=\relax
  507. X  
  508. X% @setfilename is done at the beginning of every texinfo file.
  509. X% So open here the files we need to have open while reading the input.
  510. X% This makes it possible to make a .fmt file for texinfo.
  511. X\def\setfilename{%
  512. X   \readauxfile
  513. X   \opencontents
  514. X   \openindices
  515. X   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  516. X   \comment % Ignore the actual filename.
  517. X}
  518. X
  519. X\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  520. X
  521. X\def\inforef #1{\inforefzzz #1,,,,**}
  522. X\def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}}, node `\losespace#1{}'}
  523. X\def\losespace #1{#1}
  524. X
  525. X\message{fonts,}
  526. X
  527. X% Font-change commands.
  528. X
  529. X%% Try out Computer Modern fonts at \magstephalf
  530. X\font\tenrm=cmr10 scaled \magstephalf
  531. X\font\tentt=cmtt10 scaled \magstephalf
  532. X% Instead of cmb10, you many want to use cmbx10.
  533. X% cmbx10 is a prettier font on its own, but cmb10
  534. X% looks better when embedded in a line with cmr10.
  535. X\font\tenbf=cmb10 scaled \magstephalf 
  536. X\font\tenit=cmti10 scaled \magstephalf
  537. X\font\tensl=cmsl10 scaled \magstephalf
  538. X\font\tensf=cmss10 scaled \magstephalf
  539. X\def\li{\sf}
  540. X\font\tensc=cmcsc10 scaled \magstephalf
  541. X
  542. X% Fonts for @defun, etc.
  543. X\font\defbf=cmbx10 scaled \magstep1 %was 1314
  544. X\let\deftt=\tentt
  545. X\def\df{\let\tt=\deftt \defbf}
  546. X
  547. X% Font for title
  548. X\font\titlerm = cmbx10 scaled \magstep5
  549. X
  550. X% Fonts for indices
  551. X\font\indit=cmti9 \font\indrm=cmr9
  552. X\font\indtt=cmtt9
  553. X\def\indbf{\indrm} \def\indsl{\indit}
  554. X\def\indexfonts{\let\it=\indit \let\sl=\indsl \let\bf=\indbf \let\rm=\indrm
  555. X\let\tt=\indtt}
  556. X
  557. X% Fonts for headings
  558. X\font\chaprm=cmbx10 scaled \magstep3
  559. X\font\chapit=cmti10 scaled \magstep3
  560. X\font\chapsl=cmsl10 scaled \magstep3
  561. X\font\chaptt=cmtt10 scaled \magstep3
  562. X\font\chapsf=cmss10 scaled \magstep3
  563. X\let\chapbf=\chaprm
  564. X
  565. X\font\secrm=cmbx10 scaled \magstep2
  566. X\font\secit=cmti10 scaled \magstep2
  567. X\font\secsl=cmsl10 scaled \magstep2
  568. X\font\sectt=cmtt10 scaled \magstep2
  569. X\font\secsf=cmss10 scaled \magstep2
  570. X\let\secbf=\secrm
  571. X
  572. X% \font\ssecrm=cmbx10 scaled \magstep1    % This size an fontlooked bad.
  573. X% \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  574. X% \font\ssecsl=cmsl10 scaled \magstep1
  575. X% \font\ssectt=cmtt10 scaled \magstep1
  576. X% \font\ssecsf=cmss10 scaled \magstep1
  577. X
  578. X\font\ssecrm=cmb10 at 13pt    % Note the use of cmb rather than cmbx.
  579. X\font\ssecit=cmti10 at 13pt    % Also, the size is a little larger than
  580. X\font\ssecsl=cmsl10 at 13pt    % being scaled magstep1.
  581. X\font\ssectt=cmtt10 at 13pt
  582. X\font\ssecsf=cmss10 at 13pt
  583. X
  584. X\let\ssecbf=\ssecrm
  585. X
  586. X\def\textfonts{\let\rm=\tenrm\let\it=\tenit\let\sl=\tensl\let\bf=\tenbf%
  587. X\let\smallcaps=\tensc\let\sf=\tensf}
  588. X\def\chapfonts{\let\rm=\chaprm\let\it=\chapit\let\sl=\chapsl\let\bf=\chapbf\let\tt=\chaptt\let\sf=\chapsf}
  589. X\def\secfonts{\let\rm=\secrm\let\it=\secit\let\sl=\secsl\let\bf=\secbf\let\tt=\sectt\let\sf=\secsf}
  590. X\def\subsecfonts{\let\rm=\ssecrm\let\it=\ssecit\let\sl=\ssecsl\let\bf=\ssecbf\let\tt=\ssectt\let\sf=\ssecsf}
  591. X% Count depth in font-changes, for error checks
  592. X\newcount\fontdepth \fontdepth=0
  593. X
  594. X% Font for table of contents.
  595. X\font\truesecrm=cmr12
  596. X
  597. X%% Add scribe-like font environments, plus @l for inline lisp (usually sans
  598. X%% serif) and @ii for TeX italic
  599. X
  600. X% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  601. X% unless the following character is such as not to need one.
  602. X\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  603. X\def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  604. X
  605. X\let\i=\smartitalic
  606. X\let\var=\smartitalic
  607. X\let\dfn=\smartitalic
  608. X\let\emph=\smartitalic
  609. X\let\cite=\smartitalic
  610. X
  611. X\def\b#1{{\bf #1}}
  612. X\let\strong=\b
  613. X
  614. X\def\t#1{{\tt \rawbackslash \frenchspacing #1}\null}
  615. X\let\ttfont = \t
  616. X%\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  617. X\def\samp #1{`\tclose{#1}'\null}
  618. X\def\key #1{{\tt \uppercase{#1}}\null}
  619. X\def\ctrl #1{{\tt \rawbackslash \hat}#1}
  620. X
  621. X\let\file=\samp
  622. X
  623. X% @code is a modification of @t,
  624. X% which makes spaces the same size as normal in the surrounding text.
  625. X\newdimen\tclosesave
  626. X\newdimen\tcloserm
  627. X\def\tclose#1{{\rm \tcloserm=\fontdimen2\font \tt \tclosesave=\fontdimen2\font
  628. X\fontdimen2\font=\tcloserm
  629. X\def\ {{\fontdimen2\font=\tclosesave{} }}%
  630. X \rawbackslash \frenchspacing #1\fontdimen2\font=\tclosesave}\null}
  631. X\let\code=\tclose
  632. X%\let\exp=\tclose  %Was temporary
  633. X
  634. X% @kbd is like @code, except that if the argument is just one @key command, 
  635. X% then @kbd has no effect.
  636. X
  637. X\def\xkey{\key}
  638. X\def\kbdfoo#1#2#3*{\def\one{#1}\def\three{#3}\def\threex{??}%
  639. X\ifx\one\xkey\ifx\threex\three \key{#2}
  640. X\else\tclose{\look}\fi
  641. X\else\tclose{\look}\fi}
  642. X
  643. X\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??*}
  644. X
  645. X\def\l#1{{\li #1}\null}        % 
  646. X
  647. X\def\r#1{{\rm #1}}        % roman font
  648. X\def\sc#1{{\smallcaps #1}}    % smallcaps font
  649. X\def\ii#1{{\it #1}}        % italic font
  650. X
  651. X\message{page headings,}
  652. X
  653. X\newskip\titlepagetopglue \titlepagetopglue = 1.5in
  654. X\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  655. X
  656. X% First the title page.  Must do @settitle before @titlepage.
  657. X\font\titlerm = cmbx12 scaled \magstep2
  658. X\def\titlefont#1{{\titlerm #1}}
  659. X
  660. X\newtoks\realeverypar
  661. X\newif\ifseenauthor
  662. X
  663. X\def\titlepage{\begingroup \parindent=0pt \textfonts
  664. X   \font\subtitlerm = cmr10 scaled \magstephalf
  665. X   \def\subtitlefont{\subtitlerm \normalbaselineskip = 12pt \normalbaselines}%
  666. X   %
  667. X   \font\authorrm = cmbx12 scaled \magstep1
  668. X   \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  669. X   %
  670. X   % The first subtitle should have some space before it, but not the
  671. X   % others.  They all should be ragged left.
  672. X% This code caused a bug, since two groups were started, but only
  673. X% one was ended.  Also, I can't see the point of this code.
  674. X%   \begingroup \realeverypar = {\leftskip = 2in plus 3em minus 1em
  675. X%                    \parfillskip = 0pt}%
  676. X%   \everypar = {\vglue \baselineskip \the\realeverypar
  677. X%                \everypar={\the\realeverypar}}%
  678. X   %
  679. X   % Now you can print the title using @title.
  680. X   \def\title{\parsearg\titlezzz}%
  681. X   \def\titlezzz##1{\leftline{\titlefont{##1}
  682. X            \vskip4pt \hrule height 4pt \vskip4pt}}%
  683. X   \vglue\titlepagetopglue
  684. X   %
  685. X   % Now you can put text using @subtitle.
  686. X   \def\subtitle{\parsearg\subtitlezzz}%
  687. X   \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  688. X   %
  689. X   % @author should come last, but may come many times.
  690. X   \def\author{\parsearg\authorzzz}%
  691. X   \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  692. X      {\authorfont \leftline{##1}}}%
  693. X   %  
  694. X   % Most title ``pages'' are actually two pages long, with space
  695. X   % at the top of the second.  We don't want the ragged left on the second.
  696. X   \let\oldpage = \page
  697. X%   \def\page{\vskip4pt \hrule height 2pt \vskip\titlepagebottomglue
  698. X%      \oldpage \endgroup\hrule height0pt\relax}%
  699. X   \def\page{\oldpage \hbox{}}
  700. X}
  701. X
  702. X\def\Etitlepage{\endgroup\page\HEADINGSon}
  703. X
  704. X%%% Set up page headings and footings.
  705. X
  706. X\let\thispage=\folio
  707. X
  708. X\newtoks \evenheadline    % Token sequence for heading line of even pages
  709. X\newtoks \oddheadline     % Token sequence for heading line of odd pages
  710. X\newtoks \evenfootline    % Token sequence for footing line of even pages
  711. X\newtoks \oddfootline     % Token sequence for footing line of odd pages
  712. X
  713. X% Now make Tex use those variables
  714. X\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}}
  715. X\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}}
  716. X
  717. X% Commands to set those variables.
  718. X% For example, this is what  @headings on  does
  719. X% @evenheading @thistitle|@thispage|@thischapter
  720. X% @oddheading @thischapter|@thispage|@thistitle
  721. X% @evenfooting @thisfile||
  722. X% @oddfooting ||@thisfile
  723. X
  724. X\def\evenheading{\parsearg\evenheadingxxx}
  725. X\def\oddheading{\parsearg\oddheadingxxx}
  726. X\def\everyheading{\parsearg\everyheadingxxx}
  727. X
  728. X\def\evenfooting{\parsearg\evenfootingxxx}
  729. X\def\oddfooting{\parsearg\oddfootingxxx}
  730. X\def\everyfooting{\parsearg\everyfootingxxx}
  731. X
  732. X{\catcode`\@=0 %
  733. X
  734. X\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  735. X\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  736. X\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  737. X
  738. X\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  739. X\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  740. X\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  741. X
  742. X\gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  743. X\gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  744. X\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  745. X\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  746. X
  747. X\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  748. X\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  749. X\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  750. X
  751. X\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  752. X\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  753. X\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  754. X
  755. X\gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  756. X\gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  757. X\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  758. X\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  759. X%
  760. X}% unbind the catcode of @.
  761. X
  762. X% @headings double    turns headings on for double-sided printing.
  763. X% @headings single    turns headings on for single-sided printing.
  764. X% @headings off        turns them off.
  765. X% @headings on        same as @headings double, retained for compatibility.
  766. X% By default, they are off.
  767. X
  768. X\def\headings #1 {\csname HEADINGS#1\endcsname}
  769. X
  770. X\def\HEADINGSoff{
  771. X\global\evenheadline={\hfil} \global\evenfootline={\hfil}
  772. X\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  773. X\HEADINGSoff
  774. X% When we turn headings on, set the page number to 1.
  775. X% For double-sided printing, put current file name in lower left corner,
  776. X% chapter name on inside top of right hand pages, document
  777. X% title on inside top of left hand pages, and page numbers on outside top
  778. X% edge of all pages.
  779. X\def\HEADINGSdouble{
  780. X%\pagealignmacro
  781. X\global\pageno=1
  782. X\global\evenfootline={\hfil}
  783. X\global\oddfootline={\hfil}
  784. X\global\evenheadline={\line{\folio\hfil\thistitle}}
  785. X\global\oddheadline={\line{\thischapter\hfil\folio}}
  786. X}
  787. X% For single-sided printing, chapter title goes across top left of page,
  788. X% page number on top right.
  789. X\def\HEADINGSsingle{
  790. X%\pagealignmacro
  791. X\global\pageno=1
  792. X\global\evenfootline={\hfil}
  793. X\global\oddfootline={\hfil}
  794. X\global\evenheadline={\line{\thischapter\hfil\folio}}
  795. X\global\oddheadline={\line{\thischapter\hfil\folio}}
  796. X}
  797. X\def\HEADINGSon{\HEADINGSdouble}
  798. X
  799. X% Subroutines used in generating headings
  800. X% Produces Day Month Year style of output.
  801. X\def\today{\number\day\space
  802. X\ifcase\month\or
  803. XJanuary\or February\or March\or April\or May\or June\or
  804. XJuly\or August\or September\or October\or November\or December\fi
  805. X\space\number\year}
  806. X
  807. X% Use this if you want the Month Day, Year style of output.
  808. X%\def\today{\ifcase\month\or
  809. X%January\or February\or March\or April\or May\or June\or
  810. X%July\or August\or September\or October\or November\or December\fi
  811. X%\space\number\day, \number\year}
  812. X
  813. X% @settitle line...  specifies the title of the document, for headings
  814. X% It generates no output of its own
  815. X
  816. X\def\thistitle{No Title}
  817. X\def\settitle{\parsearg\settitlezzz}
  818. X\def\settitlezzz #1{\gdef\thistitle{#1}}
  819. X
  820. X\message{tables,}
  821. X
  822. X% Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
  823. X
  824. X% default indentation of table text
  825. X\newdimen\tableindent \tableindent=.8in
  826. X% default indentation of @itemize and @enumerate text
  827. X\newdimen\itemindent  \itemindent=.3in
  828. X% margin between end of table item and start of table text.
  829. X\newdimen\itemmargin  \itemmargin=.1in
  830. X
  831. X% used internally for \itemindent minus \itemmargin
  832. X\newdimen\itemmax
  833. X
  834. X% Note @table and @ftable define @item, @itemx, etc., with these defs.
  835. X% They also define \itemindex
  836. X% to index the item name in whatever manner is desired (perhaps none).
  837. X
  838. X\def\internalBitem{\smallbreak \parsearg\itemzzz}
  839. X\def\internalBitemx{\par \parsearg\itemzzz}
  840. X
  841. X\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  842. X\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
  843. X
  844. X\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  845. X\def\internalBkitemx{\par \parsearg\kitemzzz}
  846. X
  847. X\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}\itemzzz {#1}}
  848. X
  849. X\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}\itemzzz {#1}}
  850. X
  851. X\def\itemzzz #1{\begingroup %
  852. X\advance \hsize by -\rightskip %
  853. X\advance \hsize by -\leftskip %
  854. X\setbox0=\hbox{\itemfont{#1}}%
  855. X\itemindex{#1}%
  856. X\parskip=0in %
  857. X\noindent %
  858. X\ifdim \wd0>\itemmax %
  859. X\vadjust{\penalty 10000}%
  860. X\hbox to \hsize{\hskip -\tableindent\box0\hss}\ %
  861. X\else %
  862. X\hbox to 0pt{\hskip -\tableindent\box0\hss}%
  863. X\fi %
  864. X\endgroup %
  865. X}
  866. X
  867. X\def\item{\errmessage{@item while not in a table}}
  868. X\def\itemx{\errmessage{@itemx while not in a table}}
  869. X\def\kitem{\errmessage{@kitem while not in a table}}
  870. X\def\kitemx{\errmessage{@kitemx while not in a table}}
  871. X\def\xitem{\errmessage{@xitem while not in a table}}
  872. X\def\xitemx{\errmessage{@xitemx while not in a table}}
  873. X
  874. X%% Contains a kludge to get @end[description] to work
  875. X\def\description{\tablez{\dontindex}{1}{}{}{}{}}
  876. X
  877. X\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  878. X{\obeylines\obeyspaces%
  879. X\gdef\tablex #1^^M{%
  880. X\tabley\dontindex#1        \endtabley}}
  881. X
  882. X\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  883. X{\obeylines\obeyspaces%
  884. X\gdef\ftablex #1^^M{%
  885. X\tabley\fnitemindex#1        \endtabley}}
  886. X
  887. X\def\dontindex #1{}
  888. X\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  889. X
  890. X{\obeyspaces %
  891. X\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  892. X\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  893. X
  894. X\def\tablez #1#2#3#4#5#6{%
  895. X\aboveenvbreak %
  896. X\begingroup %
  897. X\def\Edescription{\Etable}% Neccessary kludge.
  898. X\let\itemindex=#1%
  899. X\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  900. X\ifnum 0#4>0 \tableindent=#4\mil \fi %
  901. X\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  902. X\def\itemfont{#2}%
  903. X\itemmax=\tableindent %
  904. X\advance \itemmax by -\itemmargin %
  905. X\advance \leftskip by \tableindent %
  906. X\parindent = 0pt
  907. X\parskip = \smallskipamount
  908. X\ifdim \parskip=0pt \parskip=2pt \fi%
  909. X\def\Etable{\endgraf\endgroup\afterenvbreak}%
  910. X\let\item = \internalBitem %
  911. X\let\itemx = \internalBitemx %
  912. X\let\kitem = \internalBkitem %
  913. X\let\kitemx = \internalBkitemx %
  914. X\let\xitem = \internalBxitem %
  915. X\let\xitemx = \internalBxitemx %
  916. X}
  917. X
  918. X% This is the counter used by @enumerate, which is really @itemize
  919. X
  920. X\newcount \itemno
  921. X
  922. X\def\itemize{\parsearg\itemizezzz}
  923. X
  924. X\def\itemizezzz #1{\itemizey {#1}{\Eitemize}}
  925. X
  926. X\def\itemizey #1#2{%
  927. X\aboveenvbreak %
  928. X\begingroup %
  929. X\itemno = 0 %
  930. X\itemmax=\itemindent %
  931. X\advance \itemmax by -\itemmargin %
  932. X\advance \leftskip by \itemindent %
  933. X\parindent = 0pt
  934. X\parskip = \smallskipamount
  935. X\ifdim \parskip=0pt \parskip=2pt \fi%
  936. X\def#2{\endgraf\endgroup\afterenvbreak}%
  937. X\def\itemcontents{#1}%
  938. X\let\item=\itemizeitem}
  939. X
  940. X\def\bullet{$\ptexbullet$}
  941. X\def\minus{$-$}
  942. X
  943. X% Set sfcode to normal for the chars that usually have another value.
  944. X% These are `.?!:;,'
  945. X\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  946. X  \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  947. X
  948. X\def\enumerate{\itemizey{\the\itemno.}\Eenumerate\flushcr}
  949. X
  950. X% Definition of @item while inside @itemize.
  951. X
  952. X\def\itemizeitem{%
  953. X\advance\itemno by 1
  954. X{\let\par=\endgraf \smallbreak}%
  955. X\ifhmode \errmessage{\in hmode at itemizeitem}\fi
  956. X{\parskip=0in \hskip 0pt
  957. X\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  958. X\vadjust{\penalty 300}}%
  959. X\flushcr}
  960. X
  961. X\message{indexing,}
  962. X% Index generation facilities
  963. X
  964. X% Define \newwrite to be identical to plain tex's \newwrite
  965. X% except not \outer, so it can be used within \newindex.
  966. X{\catcode`\@=11
  967. X\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  968. X
  969. X% \newindex {foo} defines an index named foo.
  970. X% It automatically defines \fooindex such that
  971. X% \fooindex ...rest of line... puts an entry in the index foo.
  972. X% It also defines \fooindfile to be the number of the output channel for
  973. X% the file that    accumulates this index.  The file's extension is foo.
  974. X% The name of an index should be no more than 2 characters long
  975. X% for the sake of vms.
  976. X
  977. X\def\newindex #1{
  978. X\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  979. X\openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  980. X\expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  981. X\noexpand\doindex {#1}}
  982. X}
  983. X
  984. X% @defindex foo  ==  \newindex{foo}
  985. X
  986. X\def\defindex{\parsearg\newindex}
  987. X
  988. X% Define @defcodeindex, like @defindex except put all entries in @code.
  989. X
  990. X\def\newcodeindex #1{
  991. X\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  992. X\openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  993. X\expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  994. X\noexpand\docodeindex {#1}}
  995. X}
  996. X
  997. X\def\defcodeindex{\parsearg\newcodeindex}
  998. X
  999. X% @synindex foo bar    makes index foo feed into index bar.
  1000. X% Do this instead of @defindex foo if you don't want it as a separate index.
  1001. X\def\synindex #1 #2 {%
  1002. X\expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1003. X\noexpand\doindex {#2}}%
  1004. X}
  1005. X
  1006. X% @syncodeindex foo bar   similar, but put all entries made for index foo
  1007. X% inside @code.
  1008. X\def\syncodeindex #1 #2 {%
  1009. X\expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1010. X\noexpand\docodeindex {#2}}%
  1011. X}
  1012. X
  1013. X% Define \doindex, the driver for all \fooindex macros.
  1014. X% Argument #1 is generated by the calling \fooindex macro,
  1015. X%  and it is "foo", the name of the index.
  1016. X
  1017. X% \doindex just uses \parsearg; it calls \doind for the actual work.
  1018. X% This is because \doind is more useful to call from other macros.
  1019. X
  1020. X% There is also \dosubind {index}{topic}{subtopic}
  1021. X% which makes an entry in a two-level index such as the operation index.
  1022. X
  1023. X\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1024. X\def\singleindexer #1{\doind{\indexname}{#1}}
  1025. X
  1026. X% like the previous two, but they put @code around the argument.
  1027. X\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1028. X\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1029. X
  1030. X\def\indexdummies{%
  1031. X\def\bf{\realbackslash bf }%
  1032. X\def\rm{\realbackslash rm }%
  1033. X\def\sl{\realbackslash sl }%
  1034. X\def\dots{\realbackslash dots }%
  1035. X\def\copyright{\realbackslash copyright }%
  1036. X\def\tclose##1{\realbackslash tclose {##1}}%
  1037. X\def\code##1{\realbackslash code {##1}}%
  1038. X\def\samp##1{\realbackslash samp {##1}}%
  1039. X\def\r##1{\realbackslash r {##1}}%
  1040. X\def\i##1{\realbackslash i {##1}}%
  1041. X\def\b##1{\realbackslash b {##1}}%
  1042. X\def\cite##1{\realbackslash cite {##1}}%
  1043. X\def\key##1{\realbackslash key {##1}}%
  1044. X\def\file##1{\realbackslash file {##1}}%
  1045. X\def\var##1{\realbackslash var {##1}}%
  1046. X\def\kbd##1{\realbackslash kbd {##1}}%
  1047. X}
  1048. X
  1049. X% \indexnofonts no-ops all font-change commands.
  1050. X% This is used when outputting the strings to sort the index by.
  1051. X\def\indexdummyfont#1{#1}
  1052. X\def\indexnofonts{%
  1053. X\let\r=\indexdummyfont
  1054. X\let\i=\indexdummyfont
  1055. X\let\b=\indexdummyfont
  1056. X\let\emph=\indexdummyfont
  1057. X\let\strong=\indexdummyfont
  1058. X\let\cite=\indexdummyfont
  1059. X\let\sc=\indexdummyfont
  1060. X%Don't no-op \tt, since it isn't a user-level command
  1061. X% and is used in the definitions of the actuve chars like <, >, |...
  1062. X%\let\tt=\indexdummyfont
  1063. X\let\tclose=\indexdummyfont
  1064. X\let\code=\indexdummyfont
  1065. X\let\file=\indexdummyfont
  1066. X\let\samp=\indexdummyfont
  1067. X\let\kbd=\indexdummyfont
  1068. X\let\key=\indexdummyfont
  1069. X\let\var=\indexdummyfont
  1070. X}
  1071. X
  1072. X% To define \realbackslash, we must make \ not be an escape.
  1073. X% We must first make another character (@) an escape
  1074. X% so we do not become unable to do a definition.
  1075. X
  1076. X{\catcode`\@=0 \catcode`\\=\other
  1077. X@gdef@realbackslash{\}}
  1078. X
  1079. X\let\indexbackslash=0  %overridden during \printindex.
  1080. X
  1081. X\def\doind #1#2{%
  1082. X{\indexdummies % Must do this here, since \bf, etc expand at this stage
  1083. X\count10=\lastpenalty %
  1084. X\escapechar=`\\%
  1085. X{\let\folio=0% Expand all macros now EXCEPT \folio
  1086. X\def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1087. X% so it will be output as is; and it will print as backslash in the indx.
  1088. X%
  1089. X% Now process the index-string once, with all font commands turned off,
  1090. X% to get the string to sort the index by.
  1091. X{\indexnofonts
  1092. X\xdef\temp1{#2}%
  1093. X}%
  1094. X% Now produce the complete index entry.  We process the index-string again,
  1095. X% this time with font commands expanded, to get what to print in the index.
  1096. X\edef\temp{%
  1097. X\write \csname#1indfile\endcsname{%
  1098. X\realbackslash entry {\temp1}{\folio}{#2}}}%
  1099. X\temp }%
  1100. X\penalty\count10}}
  1101. X
  1102. X\def\dosubind #1#2#3{%
  1103. X{\indexdummies % Must do this here, since \bf, etc expand at this stage
  1104. X\count10=\lastpenalty %
  1105. X\escapechar=`\\%
  1106. X{\let\folio=0%
  1107. X\def\rawbackslashxx{\indexbackslash}%
  1108. X%
  1109. X% Now process the index-string once, with all font commands turned off,
  1110. X% to get the string to sort the index by.
  1111. X{\indexnofonts
  1112. X\xdef\temp1{#2 #3}%
  1113. X}%
  1114. X% Now produce the complete index entry.  We process the index-string again,
  1115. X% this time with font commands expanded, to get what to print in the index.
  1116. X\edef\temp{%
  1117. X\write \csname#1indfile\endcsname{%
  1118. X\realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1119. X\temp }%
  1120. X\penalty\count10}}
  1121. X
  1122. X% The index entry written in the file actually looks like
  1123. X%  \entry {sortstring}{page}{topic}
  1124. X% or
  1125. X%  \entry {sortstring}{page}{topic}{subtopic}
  1126. X% The texindex program reads in these files and writes files
  1127. X% containing these kinds of lines:
  1128. X%  \initial {c}
  1129. X%     before the first topic whose initial is c
  1130. X%  \entry {topic}{pagelist}
  1131. X%     for a topic that is used without subtopics
  1132. X%  \primary {topic}
  1133. X%     for the beginning of a topic that is used with subtopics
  1134. X%  \secondary {subtopic}{pagelist}
  1135. X%     for each subtopic.
  1136. X
  1137. X% Define the user-accessible indexing commands 
  1138. X% @findex, @vindex, @kindex, @cindex.
  1139. X
  1140. X\def\findex {\fnindex}
  1141. X\def\kindex {\kyindex}
  1142. X\def\cindex {\cpindex}
  1143. X\def\vindex {\vrindex}
  1144. X\def\tindex {\tpindex}
  1145. X\def\pindex {\pgindex}
  1146. X
  1147. X\def\cindexsub {\begingroup\obeylines\cindexsub}
  1148. X{\obeylines %
  1149. X\gdef\cindexsub "#1" #2^^M{\endgroup %
  1150. X\dosubind{cp}{#2}{#1}}}
  1151. X
  1152. X% Define the macros used in formatting output of the sorted index material.
  1153. X
  1154. X% This is what you call to cause a particular index to get printed.
  1155. X% Write
  1156. X% @unnumbered Function Index
  1157. X% @printindex fn
  1158. X
  1159. X\def\printindex{\parsearg\doprintindex}
  1160. X
  1161. X\def\doprintindex#1{\tex %
  1162. X\catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1163. X\catcode`\$=\other\catcode`\_=\other
  1164. X\catcode`\~=\other
  1165. X% The following don't help, since the chars were translated
  1166. X% when the raw index was written, and their fonts were discarded
  1167. X% due to \indexnofonts.
  1168. X%\catcode`\"=\active
  1169. X%\catcode`\^=\active
  1170. X%\catcode`\_=\active
  1171. X%\catcode`\|=\active
  1172. X%\catcode`\<=\active
  1173. X%\catcode`\>=\active
  1174. X\def\indexbackslash{\rawbackslashxx}
  1175. X\indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1176. X\begindoublecolumns
  1177. X\openin 1 \jobname.#1s
  1178. X\ifeof 1 \else \closein 1 \input \jobname.#1s
  1179. X\fi
  1180. X\enddoublecolumns
  1181. X\Etex}
  1182. X
  1183. X% These macros are used by the sorted index file itself.
  1184. X% Change them to control the appearance of the index.
  1185. X
  1186. X% Same as \bigskipamount except no shrink.
  1187. X% \balancecolumns gets confused if there is any shrink.
  1188. X\newskip\initialskipamount \initialskipamount 12pt plus4pt
  1189. X
  1190. X\outer\def\initial #1{%
  1191. X{\let\tentt=\sectt \let\sf=\sectt
  1192. X\ifdim\lastskip<\initialskipamount
  1193. X\removelastskip \penalty-200 \vskip \initialskipamount\fi
  1194. X\line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1195. X
  1196. X\outer\def\entry #1#2{
  1197. X{\parfillskip=0in \parskip=0in \parindent=0in
  1198. X\hangindent=1in \hangafter=1%
  1199. X\noindent\hbox{#1}\dotfill #2\par
  1200. X}}
  1201. X
  1202. X\def\primary #1{\line{#1\hfil}}
  1203. X
  1204. X\newskip\secondaryindent \secondaryindent=0.5cm
  1205. X
  1206. X\def\secondary #1#2{
  1207. X{\parfillskip=0in \parskip=0in
  1208. X\hangindent =1in \hangafter=1
  1209. X\noindent\hskip\secondaryindent\hbox{#1}\dotfill #2\par
  1210. X}}
  1211. X
  1212. X%% Define two-column mode, which is used in indexes.
  1213. X%% Adapted from the TeXBook, page 416
  1214. X\catcode `\@=11
  1215. X
  1216. X\newbox\partialpage
  1217. X
  1218. X\newdimen\doublecolumnhsize  \doublecolumnhsize = 3.11in
  1219. X\newdimen\doublecolumnvsize  \doublecolumnvsize = 19.1in
  1220. X\newdimen\availdimen@
  1221. X
  1222. X\def\begindoublecolumns{\begingroup
  1223. X  \output={\global\setbox\partialpage=\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
  1224. X  \output={\doublecolumnout} \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
  1225. X\def\enddoublecolumns{\output={\balancecolumns}\eject
  1226. X  \endgroup \pagegoal=\vsize}
  1227. X
  1228. X\def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1229. X  \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1230. X  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1231. X  \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
  1232. X\def\pagesofar{\unvbox\partialpage %
  1233. X  \hsize=\doublecolumnhsize % have to restore this since output routine
  1234. X%          changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986)
  1235. X  \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1236. X\def\balancecolumns{%
  1237. X% Unset the glue.
  1238. X  \setbox255=\vbox{\unvbox255}
  1239. X  \dimen@=\ht255
  1240. X  \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1241. X  \divide\dimen@ by2
  1242. X  \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpage
  1243. X% If the remaining data is too big for one page,
  1244. X% output one page normally, then work with what remains.
  1245. X  \ifdim \dimen@>\availdimen@
  1246. X   {
  1247. X     \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1248. X     \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1249. X     \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1250. X     \onepageout\pagesofar
  1251. X   }
  1252. X% Recompute size of what remains, in case we just output some of it.
  1253. X  \dimen@=\ht255
  1254. X  \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1255. X  \divide\dimen@ by2
  1256. X  \fi
  1257. X  \setbox0=\vbox{\unvbox255}
  1258. X  \splittopskip=\topskip
  1259. X  {\vbadness=10000 \loop \global\setbox3=\copy0
  1260. X    \global\setbox1=\vsplit3 to\dimen@
  1261. X    \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
  1262. X  \setbox0=\vbox to\dimen@{\unvbox1}  \setbox2=\vbox to\dimen@{\unvbox3}
  1263. X  \pagesofar}
  1264. X
  1265. X\catcode `\@=\other
  1266. X\message{sectioning,}
  1267. X% Define chapters, sections, etc.
  1268. X
  1269. X\newcount \chapno
  1270. X\newcount \secno
  1271. X\newcount \subsecno
  1272. X\newcount \subsubsecno
  1273. X
  1274. X% This counter is funny since it counts through charcodes of letters A, B, ...
  1275. X\newcount \appendixno  \appendixno = `\@
  1276. X\def\appendixletter{\char\the\appendixno}
  1277. X
  1278. X\newwrite \contentsfile
  1279. X% This is called from \setfilename.
  1280. X\def\opencontents{\openout \contentsfile = \jobname.toc}
  1281. X
  1282. X% Each @chapter defines this as the name of the chapter.
  1283. X% page headings and footings can use it.  @section does likewise
  1284. X
  1285. X\def\thischapter{} \def\thissection{}
  1286. X\def\seccheck#1{\if \pageno<0 %
  1287. X\errmessage{@#1 not allowed after generating table of contents}\fi
  1288. X%
  1289. X}
  1290. X
  1291. X\def\chapternofonts{%
  1292. X\let\rawbackslash=\relax%
  1293. X\let\frenchspacing=\relax%
  1294. X\def\char{\realbackslash char}
  1295. X\def\tclose##1{\realbackslash tclose {##1}}
  1296. X\def\code##1{\realbackslash code {##1}}
  1297. X\def\samp##1{\realbackslash samp {##1}}
  1298. X\def\r##1{\realbackslash r {##1}}
  1299. X\def\i##1{\realbackslash i {##1}}
  1300. X\def\b##1{\realbackslash b {##1}}
  1301. X\def\cite##1{\realbackslash cite {##1}}
  1302. X\def\key##1{\realbackslash key {##1}}
  1303. X\def\file##1{\realbackslash file {##1}}
  1304. X\def\var##1{\realbackslash var {##1}}
  1305. X\def\kbd##1{\realbackslash kbd {##1}}
  1306. X}
  1307. X
  1308. X\outer\def\chapter{\parsearg\chapterzzz}
  1309. X\def\chapterzzz #1{\seccheck{chapter}%
  1310. X\secno=0 \subsecno=0 \subsubsecno=0 \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1311. X\chapmacro {#1}{\the\chapno}%
  1312. X\gdef\thissection{#1}\gdef\thischapter{#1}%
  1313. X{\chapternofonts%
  1314. X\edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1315. X\escapechar=`\\%
  1316. X\write \contentsfile \temp  %
  1317. X\donoderef %
  1318. X}}
  1319. X
  1320. X\outer\def\appendix{\parsearg\appendixzzz}
  1321. X\def\appendixzzz #1{\seccheck{appendix}%
  1322. X\secno=0 \subsecno=0 \subsubsecno=0 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1323. X\chapmacro {#1}{Appendix \appendixletter}%
  1324. X\gdef\thischapter{#1}\gdef\thissection{#1}%
  1325. X{\chapternofonts%
  1326. X\edef\temp{{\realbackslash chapentry {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
  1327. X\escapechar=`\\%
  1328. X\write \contentsfile \temp  %
  1329. X\appendixnoderef %
  1330. X}}
  1331. X
  1332. X\outer\def\unnumbered{\parsearg\unnumberedzzz}
  1333. X\def\unnumberedzzz #1{\seccheck{unnumbered}%
  1334. X\secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
  1335. X\unnumbchapmacro {#1}%
  1336. X\gdef\thischapter{#1}\gdef\thissection{#1}%
  1337. X{\chapternofonts%
  1338. X\edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  1339. X\escapechar=`\\%
  1340. X\write \contentsfile \temp  %
  1341. X\unnumbnoderef %
  1342. X}}
  1343. X
  1344. X\outer\def\section{\parsearg\sectionzzz}
  1345. X\def\sectionzzz #1{\seccheck{section}%
  1346. X\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1347. X\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1348. X{\chapternofonts%
  1349. X\edef\temp{{\realbackslash secentry %
  1350. X{#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  1351. X\escapechar=`\\%
  1352. X\write \contentsfile \temp %
  1353. X\donoderef %
  1354. X\penalty 10000 %
  1355. X}}
  1356. X
  1357. X\outer\def\appendixsection{\parsearg\appendixsectionzzz}
  1358. X\outer\def\appendixsec{\parsearg\appendixsectionzzz}
  1359. X\def\appendixsectionzzz #1{\seccheck{appendixsection}%
  1360. X\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1361. X\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1362. X{\chapternofonts%
  1363. X\edef\temp{{\realbackslash secentry %
  1364. X{#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  1365. X\escapechar=`\\%
  1366. X\write \contentsfile \temp %
  1367. X\appendixnoderef %
  1368. X\penalty 10000 %
  1369. X}}
  1370. X
  1371. X\outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
  1372. X\def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  1373. X\plainsecheading {#1}\gdef\thissection{#1}%
  1374. X{\chapternofonts%
  1375. X\edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  1376. X\escapechar=`\\%
  1377. X\write \contentsfile \temp %
  1378. X\unnumbnoderef %
  1379. X\penalty 10000 %
  1380. X}}
  1381. X
  1382. X\outer\def\subsection{\parsearg\subsectionzzz}
  1383. X\def\subsectionzzz #1{\seccheck{subsection}%
  1384. X\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1385. X\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1386. X{\chapternofonts%
  1387. X\edef\temp{{\realbackslash subsecentry %
  1388. X{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1389. X\escapechar=`\\%
  1390. X\write \contentsfile \temp %
  1391. X\donoderef %
  1392. X\penalty 10000 %
  1393. X}}
  1394. X
  1395. X\outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
  1396. X\def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  1397. X\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1398. X\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1399. X{\chapternofonts%
  1400. X\edef\temp{{\realbackslash subsecentry %
  1401. X{#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1402. X\escapechar=`\\%
  1403. X\write \contentsfile \temp %
  1404. X\appendixnoderef %
  1405. X\penalty 10000 %
  1406. X}}
  1407. X
  1408. X\outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1409. X\def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  1410. X\plainsecheading {#1}\gdef\thissection{#1}%
  1411. X{\chapternofonts%
  1412. X\edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  1413. X\escapechar=`\\%
  1414. X\write \contentsfile \temp %
  1415. X\unnumbnoderef %
  1416. X\penalty 10000 %
  1417. X}}
  1418. X
  1419. X\outer\def\subsubsection{\parsearg\subsubsectionzzz}
  1420. X\def\subsubsectionzzz #1{\seccheck{subsubsection}%
  1421. X\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1422. X\subsubsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1423. X{\chapternofonts%
  1424. X\edef\temp{{\realbackslash subsubsecentry %
  1425. X{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
  1426. X\escapechar=`\\%
  1427. X\write \contentsfile \temp %
  1428. X\donoderef %
  1429. X\penalty 10000 %
  1430. X}}
  1431. X
  1432. X\outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1433. X\def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  1434. X\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1435. X\subsubsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1436. X{\chapternofonts%
  1437. X\edef\temp{{\realbackslash subsubsecentry{#1}%
  1438. X{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
  1439. X\escapechar=`\\%
  1440. X\write \contentsfile \temp %
  1441. X\appendixnoderef %
  1442. X\penalty 10000 %
  1443. X}}
  1444. X
  1445. X\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1446. X\def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  1447. X\plainsecheading {#1}\gdef\thissection{#1}%
  1448. X{\chapternofonts%
  1449. X\edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  1450. X\escapechar=`\\%
  1451. X\write \contentsfile \temp %
  1452. X\unnumbnoderef %
  1453. X\penalty 10000 %
  1454. X}}
  1455. X
  1456. X% These are variants which are not "outer", so they can appear in @ifinfo.
  1457. X\def\infounnumbered{\parsearg\unnumberedzzz}
  1458. X\def\infounnumberedsec{\parsearg\unnumberedseczzz}
  1459. X\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1460. X\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1461. X
  1462. X\def\infoappendix{\parsearg\appendixzzz}
  1463. X\def\infoappendixsec{\parsearg\appendixseczzz}
  1464. X\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  1465. X\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1466. X
  1467. X\def\infochapter{\parsearg\chapterzzz}
  1468. X\def\infosection{\parsearg\sectionzzz}
  1469. X\def\infosubsection{\parsearg\subsectionzzz}
  1470. X\def\infosubsubsection{\parsearg\subsubsectionzzz}
  1471. X
  1472. X% Define @majorheading, @heading and @subheading
  1473. X
  1474. X\def\majorheading #1{%
  1475. X{\advance\chapheadingskip by 10pt \chapbreak }%
  1476. X{\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 200}
  1477. X
  1478. X\def\chapheading #1{\chapbreak %
  1479. X{\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 200}
  1480. X
  1481. X\def\heading{\parsearg\secheadingi}
  1482. X
  1483. X% These macros generate a chapter, section, etc. heading only
  1484. X% (including whitespace, linebreaking, etc. around it),
  1485. X% given all the information in convenient, parsed form.
  1486. X
  1487. X%%% Args are the skip and penalty (usually negative)
  1488. X\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  1489. X
  1490. X\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  1491. X
  1492. X%%% Define plain chapter starts, and page on/off switching for it
  1493. X% Parameter controlling skip before chapter headings (if needed)
  1494. X
  1495. X\newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  1496. X
  1497. X\def\chapbreak{\dobreak \chapheadingskip {-4000}}
  1498. X\def\chappager{\par\vfill\supereject}
  1499. X\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  1500. X
  1501. X\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  1502. X
  1503. X\def\CHAPPAGoff{
  1504. X\global\let\pchapsepmacro=\chapbreak
  1505. X\global\let\pagealignmacro=\chappager}
  1506. X
  1507. X\def\CHAPPAGon{
  1508. X\global\let\pchapsepmacro=\chappager
  1509. X\global\let\pagealignmacro=\chappager
  1510. X\global\def\HEADINGSon{\HEADINGSsingle}}
  1511. X
  1512. X\def\CHAPPAGodd{
  1513. X\global\let\pchapsepmacro=\chapoddpage
  1514. X\global\let\pagealignmacro=\chapoddpage
  1515. X\global\def\HEADINGSon{\HEADINGSdouble}}
  1516. X
  1517. X\CHAPPAGon
  1518. X
  1519. X\def\CHAPFplain{
  1520. X\global\let\chapmacro=\chfplain
  1521. X\global\let\unnumbchapmacro=\unnchfplain}
  1522. X
  1523. X\def\chfplain #1#2{%
  1524. X\pchapsepmacro %
  1525. X{\chapfonts \line{\rm #2.\enspace #1\hfill}}\bigskip \par\penalty 5000 %
  1526. X}
  1527. X
  1528. X\def\unnchfplain #1{%
  1529. X\pchapsepmacro %
  1530. X{\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 10000 %
  1531. X}
  1532. X\CHAPFplain % The default
  1533. X
  1534. X\def\unnchfopen #1{%
  1535. X\chapoddpage {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 10000 %
  1536. X}
  1537. X
  1538. X\def\chfopen #1#2{\chapoddpage {\chapfonts
  1539. X\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  1540. X\par\penalty 5000 %
  1541. X}
  1542. X
  1543. X\def\CHAPFopen{
  1544. X\global\let\chapmacro=\chfopen
  1545. X\global\let\unnumbchapmacro=\unnchfopen}
  1546. X
  1547. X% Parameter controlling skip before section headings.
  1548. X
  1549. X\newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  1550. X\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  1551. X
  1552. X\newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  1553. X\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  1554. X
  1555. X
  1556. X% Section fonts are the base font at magstep2, which produces
  1557. X% a size a bit more than 14 points in the default situation.    
  1558. X
  1559. X\def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  1560. X\def\plainsecheading #1{\secheadingi {#1}}
  1561. X\def\secheadingi #1{{\advance \secheadingskip by \parskip %
  1562. X\secheadingbreak}%
  1563. X{\secfonts \line{\rm #1\hfill}}%
  1564. X\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1565. X
  1566. X
  1567. X% Subsection fonts are the base font at magstep1, 
  1568. X% which produces a size of 12 points.
  1569. X
  1570. X\def\subsecheading #1#2#3#4{{\advance \subsecheadingskip by \parskip %
  1571. X\subsecheadingbreak}%
  1572. X{\subsecfonts \line{\rm#2.#3.#4\enspace #1\hfill}}%
  1573. X\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1574. X
  1575. X\def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  1576. X                  % Perhaps make sssec fonts scaled
  1577. X                  % magstep half
  1578. X\def\subsubsecheading #1#2#3#4#5{{\advance \subsecheadingskip by \parskip %
  1579. X\subsecheadingbreak}%
  1580. X{\subsubsecfonts \line{\rm#2.#3.#4.#5\enspace #1\hfill}}%
  1581. X\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  1582. X
  1583. X
  1584. X\message{toc printing,}
  1585. X
  1586. X% Finish up the main text and prepare to read what we've written
  1587. X% to \contentsfile.
  1588. X
  1589. X\def\startcontents#1{%
  1590. X   \ifnum \pageno>0
  1591. X      \pagealignmacro
  1592. X      \immediate\closeout \contentsfile
  1593. X      \pageno = -1        % Request roman numbered pages.
  1594. X   \fi
  1595. X   \unnumbchapmacro{#1}\def\thischapter{#1}%
  1596. X   \begingroup           % Set up to handle contents files properly.
  1597. X      \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  1598. X      \raggedbottom             % Worry more about breakpoints than the bottom.
  1599. X      \advance\hsize by -1in    % Don't use the full line length.
  1600. X}
  1601. X
  1602. X  
  1603. X% Normal (long) toc.
  1604. X\outer\def\contents{%
  1605. X   \startcontents{Table of Contents}%
  1606. X      \input \jobname.toc
  1607. X   \endgroup
  1608. X   \vfill \eject
  1609. X}
  1610. X
  1611. X% And just the chapters.
  1612. X\outer\def\summarycontents{%
  1613. X   \startcontents{Short Contents}%
  1614. X      %
  1615. X      \let\chapentry = \shortchapentry
  1616. X      \let\unnumbchapentry = \shortunnumberedentry
  1617. X      % We want a true roman here for the page numbers.
  1618. X      \secfonts \let\rm = \truesecrm \rm
  1619. X      \advance\baselineskip by 1pt % Open it up a little.
  1620. X      \def\secentry ##1##2##3##4{}
  1621. X      \def\unnumbsecentry ##1##2{}
  1622. X      \def\subsecentry ##1##2##3##4##5{}
  1623. X      \def\unnumbsubsecentry ##1##2{}
  1624. X      \def\subsubsecentry ##1##2##3##4##5##6{}
  1625. X      \def\unnumbsubsubsecentry ##1##2{}
  1626. X      \input \jobname.toc
  1627. X   \endgroup
  1628. X   \vfill \eject
  1629. X}
  1630. X\let\shortcontents = \summarycontents
  1631. X
  1632. X% These macros generate individual entries in the table of contents.
  1633. X% The first argument is the chapter or section name.
  1634. X% The last argument is the page number.
  1635. X% The arguments in between are the chapter number, section number, ...
  1636. X
  1637. X% Chapter-level things, for both the long and short contents.
  1638. X\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  1639. X\def\shortchapentry#1#2#3{%
  1640. X   \line{{#2\labelspace #1}\dotfill\doshortpageno{#3}}%
  1641. X}
  1642. X
  1643. X\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  1644. X\def\shortunnumberedentry#1#2{%
  1645. X   \line{#1\dotfill\doshortpageno{#2}}%
  1646. X}
  1647. X
  1648. X% Sections.
  1649. X\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  1650. X\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  1651. X
  1652. X% Subsections.
  1653. X\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  1654. X\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  1655. X
  1656. X% And subsubsections.
  1657. X\def\subsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  1658. X\def\unnumbsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  1659. X
  1660. X
  1661. X% This parameter controls the indentation of the various levels.
  1662. X\newdimen\tocindent \tocindent = 3pc
  1663. X
  1664. X% Now for the actual typesetting. In all these, #1 is the text and #2 is the 
  1665. X% page number.
  1666. X%
  1667. X% If the toc has to be broken over pages, we would want to be at chapters 
  1668. X% if at all possible; hence the \penalty.
  1669. X\def\dochapentry#1#2{%
  1670. X   \penalty-300 \vskip\baselineskip
  1671. END_OF_FILE
  1672.   if test 49357 -ne `wc -c <'./support/texinfo.tex.01'`; then
  1673.     echo shar: \"'./support/texinfo.tex.01'\" unpacked with wrong size!
  1674.   fi
  1675.   # end of './support/texinfo.tex.01'
  1676. fi
  1677. echo shar: End of archive 9 \(of 16\).
  1678. cp /dev/null ark9isdone
  1679. MISSING=""
  1680. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
  1681.     if test ! -f ark${I}isdone ; then
  1682.     MISSING="${MISSING} ${I}"
  1683.     fi
  1684. done
  1685. if test "${MISSING}" = "" ; then
  1686.     echo You have unpacked all 16 archives.
  1687.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1688. else
  1689.     echo You still must unpack the following archives:
  1690.     echo "        " ${MISSING}
  1691. fi
  1692. exit 0
  1693. exit 0 # Just in case...
  1694.